<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" > 

<html>
<head>
<base href="<%=basePath%>">
<title>疾病列表</title>
<link rel="stylesheet" type="text/css" href="./js/bootstrap-3.3.5-dist/css/bootstrap.css" />
<link href="./js/metisMenu/metisMenu.min.css" rel="stylesheet">
<link href="./css/sb-admin/sb-admin-2.css" rel="stylesheet">
<link rel="stylesheet" href="./js/font-awesome/css/font-awesome.min.css">
<link href="./css/base.css" rel="stylesheet">
<link rel="stylesheet" href="./js/bootstrap-table/bootstrap-table.min.css">
<link rel="stylesheet" href="./js/bootstrap-multiselect/bootstrap-multiselect.css"/>
<link rel="stylesheet" href="./js/bootstrap-3.3.5-dist/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="./css/illness.css">
<script type="text/javascript" src="./js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="./js/bootstrap-3.3.5-dist/js/bootstrap.js"></script>
<script src="./js/bootstrap-table/bootstrap-table-all.js"></script>
<script src="./js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="./js/metisMenu/metisMenu.js"></script>
<script src="./js/bootstrap-multiselect/bootstrap-multiselect.js"></script>
<script src="./js/bootstrap-3.3.5-dist/js/bootstrap-datetimepicker.js"></script>
<script src="./js/bootstrap-3.3.5-dist/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="./js/bootstrap-jquery-plugin/jquery.bootstrap.js"></script>
<script type="text/javascript" src="./js/common.js"></script>
<script type="text/javascript" src="./js/xss.js"></script>
</head>
<body>
<jsp:include page="../template/head.jsp" />
<jsp:include page="../template/leftnav.jsp" />
<div id="page-wrapper">
	<div>
		<h1>疾病列表</h1>
	</div>
	<div class="content">
		<form class="form-inline">
			<div class="form-group">
				<label for="slevelOneSubject">一级科目：</label>
				<input type="text" id="slevelOneSubject" class="form-control" placeholder="请输入一级科目" onkeyup="filters(this)" onchange="filters(this)">
			</div>
			
			<div class="form-group">
				<label for="slevelTwoSubject">二级科目：</label>
				<input type="text" id="slevelTwoSubject" class="form-control" placeholder="请输入二级科目" onkeyup="filters(this)" onchange="filters(this)">
			</div>
			
			<div class="form-group">
				<label for="sparts">发生部位：</label>
				<input type="text" id="sparts" class="form-control" placeholder="请输入发生部位" onkeyup="filters(this)" onchange="filters(this)">
			</div>
			<br>
			<div class="form-group">
				<label for="sillness">疾病名称：</label>
				<input type="text" id="sillness" class="form-control" placeholder="请输入疾病名称" onkeyup="filters(this)" onchange="filters(this)">
			</div>
			<div class="form-group">
				<label for="ssymptom">症状名称：</label>
				<input type="text" id="ssymptom" class="form-control" placeholder="请输入症状名称" onkeyup="filters(this)" onchange="filters(this)">
			</div>
			<div class="form-group">
				<label for="sdiseaseAge">年龄选择：</label>
				<select id="sdiseaseAgeSel" multiple="multiple">
				    	<option value="1" selected>0-30天</option>
					    <option value="2" selected>31天-3岁</option>
					    <option value="3" selected>4-8岁</option>
					    <option value="4" selected>9-14岁</option>
					    <option value="5" selected>15-35岁</option>
					    <option value="6" selected>36-64岁</option>
					    <option value="7" selected>65岁以上</option>
				</select>
			</div>
			<br>
			<div class="form-group">
				<label for="time">创建时间：</label>
				<input class="form-control" type="text" id="startTime" placeholder="请输入开始的时间">
				<span>到</span>
				<input class="form-control" type="text" id="endTime" placeholder="请输入结束的时间">
				<button class="btn  search-btn" id="search">搜索</button>
				<button id="create" class="btn">新增</button>
				<button id="reset" class="btn btn-default">重置</button>
		</form>

		 <table id="table" data-toolbar="#toolbar" data-toggle="table" data-row-style="rowStyle" data-classes="table  table-no-bordered"
	           data-minimum-count-columns="2"  data-cache="false" data-pagination="true"  data-striped="data-striped"
	           data-page-list="[5, 10, 20, 50]"  data-query-params="tableQueryParams" style="word-break:break-all;"
	           data-side-pagination="server" data-page-size=10 data-url="./adminIllness/getIllnessList"
	           data-detail-view="true"
			   data-detail-formatter="detailFormatter">
	           <thead>
				<tr class="headTr">
					<th data-field="illness" data-width="20%" >疾病名</th>
					<th data-field="levelOneSubject" data-width ="8%">一级</th>
					<th data-field="levelTwoSubject" data-width ="8%">二级</th>
					<th data-field="warning" data-width ="10%" data-formatter="warningFormatter">病情分级</th>
					<th data-field="author" data-width ="14%">创建人</th>
					<th data-field="createTime" data-width ="15%" data-formatter="dateFormatter">创建日期</th>
					<th data-field="operation" data-width ="25%" data-formatter="operFormatter">操作</th>
				</tr>
			</thead>
	    </table>
	    <div id="illOperTemp" style="display:none">
			<ul class="list-inline">
				<li role="presentation"><a role="button" class="btn detail—btn">详情</a></li>
<!-- 				<li role="presentation"><a class="btn btn-primary" style="margin-top:5px;">编辑</a></li> -->
				<li role="presentation"><a role="button" class="btn btn-danger">删除</a></li>
				<li role="presentation"><a class="btn btn-primary"">导出</a></li>
			</ul>
		</div>
    </div>
</div>
<div id="createwrap" style="display:none">
  <form id="createform" role="form" class="form-horizontal">
    <div class="form-group">
    	<label for="illness" class="col-sm-3 control-label">疾病名称:</label>
    	<div class="col-sm-8">
      		<input class="form-control" id="illnessName" placeholder="请输入疾病名称" onkeyup="filters(this)" onchange="filters(this)"/>
    	</div>
    	<br>
    	<br>
    	
   	 	<label for="levelOneSubject" class="col-sm-3 control-label">一级科目:</label>
    	<div class="col-sm-8">
      		<input class="form-control" id="levelOneSubject" placeholder="请输入一级科目名称" onkeyup="filters(this)" onchange="filters(this)"/>
    	</div>
    	<br>
    	<br>
    	
    	<label for="levelTwoSubject" class="col-sm-3 control-label">二级科目:</label>
    	<div class="col-sm-8">
      		<input class="form-control" id="levelTwoSubject" placeholder="请输入二级科目名称" onkeyup="filters(this)" onchange="filters(this)"/>
    	</div>
    	<br>
    	<br>
    	
    	<label for="parts" class="col-sm-3 control-label">发生部位:</label>
        <div class="col-sm-8">
            <textarea class="form-control" id="parts" placeholder="请输入发生部位，多个用逗号隔开"></textarea>
        </div>
        <br>
    	<br>
    	
      	<label for="symptoms" class="col-sm-3 control-label">症状名称:</label>
      	<div class="col-sm-8" style="margin-top:5px">
      		<textarea class="form-control" id="symptoms" placeholder="请输入症状名称，多个用逗号隔开，例：发热，发冷，温度（27~29）" onkeyup="filters(this)" onchange="filters(this)"></textarea>
      	</div>
        <br>
    	<br>
    	
    	<label for="duration" class="col-sm-3 control-label">发病时间:</label>
      	<div class="col-sm-8" style="margin-top:5px">
      		<textarea class="form-control" id="duration" placeholder="请输入发病时间" onkeyup="filters(this)" onchange="filters(this)"></textarea>
      	</div>
        <br>
    	<br>
    	
    	<label for="examNames" class="col-sm-3 control-label">辅助检查:</label>
      	<div class="col-sm-8" style="margin-top:5px">
      		<textarea class="form-control" id="examNames" placeholder="请输入辅助检查，多个用逗号隔开，例：x光，b超" onkeyup="filters(this)" onchange="filters(this)"></textarea>
      	</div>
        <br>
    	<br>
    	
    	<label for="isInjured" class="col-sm-3 control-label">是否受伤:</label>
        <div class="col-sm-8" style="margin-top:5px">
            <!-- <input class="form-control" id="isInjured" placeholder="请输入是否受伤，是或否"/> -->
            <select id="isInjuredSel">
			    <option value="1" selected>是</option>
			    <option value="0" selected>否</option>
			</select>
        </div>
        <br>
    	<br>
    	
        <label for="specialCrowd" class="col-sm-3 control-label" >多发性别:</label>
        <div class="col-sm-8" style="margin-top:5px">
            <!-- <textarea class="form-control" style="margin-top:5px" id="specialCrowd" placeholder="请输入多发人群(儿童男，儿童女，成年男，成年女，全部五类)，多选为(儿童男，儿童女)" onkeyup="filters(this)" onchange="filters(this)"></textarea> -->
            <select id="specialCrowdSel">
			    <option value="male" selected>男</option>
			    <option value="female" selected>女</option>
			    <option value="all" selected>全部</option>
			</select>
        </div>
        <br>
    	<br>
    	
        <label for="disage" class="col-sm-3 control-label">多发年龄:</label>
        <div class="col-sm-8" style="margin-top:5px">
            <!-- <input class="form-control" style="margin-top:5px" id="diseaseAge" placeholder="请输入多发年龄段，例：10,20,不填默认为全年龄段" onkeyup="filters(this)" onchange="filters(this)"/> -->
        	<select id="ssdiseaseAgeSel" multiple="multiple">
			    <option value="0,6" selected>儿童(0~6)</option>
			    <option value="7,17" selected>少年(7~17)</option>
			    <option value="18,40" selected>青年(18~40)</option>
			    <option value="41,65" selected>中年(41~65)</option>
			    <option value="66,200" selected>老年(66~~)</option>
			</select>
        </div>
        
        <label for="pathogen" class="col-sm-3 control-label">病情病因:</label>
      	<div class="col-sm-8" style="margin-top:5px">
      		<textarea class="form-control" id="pathogen" placeholder="请输入病情病因" onkeyup="filters(this)" onchange="filters(this)"></textarea>
      	</div>
        <br>
    	<br>
    	
    	<label for="scheme" class="col-sm-3 control-label">诊疗方案:</label>
      	<div class="col-sm-8" style="margin-top:5px">
      		<textarea class="form-control" id="scheme" placeholder="请输入诊疗方案" onkeyup="filters(this)" onchange="filters(this)"></textarea>
      	</div>
        <br>
    	<br>
    	
    	<label for="medicine" class="col-sm-3 control-label">疾病用药:</label>
      	<div class="col-sm-8" style="margin-top:5px">
      		<textarea class="form-control" id="medicine" placeholder="请输入疾病用药，多个用逗号隔开，例：安康，达克宁" onkeyup="filters(this)" onchange="filters(this)"></textarea>
      	</div>
        <br>
    	<br>
        
    </div>
</div>
<script>

$(function () {
	
	"use strict";
	
	$('#sdiseaseAgeSel').multiselect({
	 	includeSelectAllOption: true,
	 	selectAllText: "全部年龄",
	 	allSelectedText:"全选",
	 	nonSelectedText:"无",
	 	buttonWidth: '150px'
	 });
	 
	 $('#ssdiseaseAgeSel').multiselect({
	 	includeSelectAllOption: true,
	 	selectAllText: "全部年龄",
	 	allSelectedText:"全选",
	 	nonSelectedText:"无",
	 	buttonWidth: '150px'
	 });
	 
	 $('#specialCrowdSel').multiselect({
	 	includeSelectAllOption: true,
	 	buttonWidth: '150px'
	 });
	 
	 $('#isInjuredSel').multiselect({
	 	includeSelectAllOption: true,
	 	buttonWidth: '150px'
	 });

	$('#search').on('click', function (e) {
		e.preventDefault();
		searchOrder();
	});
	
	$('#create').on('click', function (e) {
		e.preventDefault();
		/* createIll(); */
		window.location.href="./jsp/illness/addillness.jsp";
	});
	
});

function tableQueryParams(params) {
	var queryObj = getQueryObject();
	var newParams = $.extend(params,queryObj);
	return newParams;
}
	
function getQueryObject(){
	var queryObj;
	var illness = $("#sillness").val();
	var symptom = $("#ssymptom").val();
	var parts = $("#sparts").val();
	var levelOneSubject = $("#slevelOneSubject").val();
	var levelTwoSubject = $("#slevelTwoSubject").val();
	var age = $("#sdiseaseAgeSel").val();
	var diseaseAge;
	var startVal = $("#startTime").val();
	var endVal = $("#endTime").val();
	
	//设置默认时间为1900-01-01
	var defaultTime = new Date();
	defaultTime.setFullYear(1900,0,1);
	defaultTime.setHours(0);
	defaultTime.setMinutes(0);
	defaultTime.setSeconds(0);
	//日期
	var startTime = new Date(startVal);
	var endTime = new Date(endVal);
	startTime.setHours(0);
	startTime.setMinutes(0);
	startTime.setSeconds(0);
	endTime.setHours(23);
	endTime.setMinutes(59);
	endTime.setSeconds(59);
	
	var todayStart = new Date();
	var todayEnd = new Date();
	todayStart.setHours(0);
	todayStart.setMinutes(0);
	todayStart.setSeconds(0);
	todayEnd.setHours(23);
	todayEnd.setMinutes(59);
	todayEnd.setSeconds(59);
	
	if(startVal == "" || endVal == ""){
		var queryObj = {
			isSearch: true,
			illness: illness,
			symptom: symptom,
			parts : parts,
			levelOneSubject : levelOneSubject,
			levelTwoSubject : levelTwoSubject,
			age : age?age.join(','):age.join(','),
			startTime : defaultTime,
			endTime : todayEnd
		}
	}else{
		var queryObj = {
			isSearch: true,
			illness: illness,
			symptom: symptom,
			parts : parts,
			levelOneSubject : levelOneSubject,
			levelTwoSubject : levelTwoSubject,
			age : age?age.join(','):age.join(','),
			startTime : startTime,
			endTime : endTime
		}
	}
	
	if(illness ==""){
		delete queryObj.illness;
	}
	
	if(symptom ==""){
		delete queryObj.symptom;
	}
	
	if(parts ==""){
		delete queryObj.parts;
	}
	
	if(levelOneSubject ==""){
		delete queryObj.levelOneSubject;
	}
	
	if(levelTwoSubject ==""){
		delete queryObj.levelTwoSubject;
	}
	
	if(age ==""){
		delete queryObj.age;
	}
	
	return queryObj;
}
	
function searchOrder(){
	var queryObj = getQueryObject();
	$('#table').bootstrapTable('refresh', {
		query : {
			offset: 0
		},
		url : "./adminIllness/getIllnessList",
		silent : true
	});
}

function symptomFormatter(value,row){
	var symArr = [];
	if(value==''){
		return '-';
	}else{
		for(var i=0;i<value.length;i++){
			symArr.push(value[i].symptom);
		}
		return symArr.unique();
	}
}

function partsFormatter(value,row){
	var partArr = [];
	if(value==''){
		return '-';
	}else{
		for(var i=0;i<value.length;i++){
			if(value[i].parts=='' || value[i].parts==null){
				continue;
			}
			partArr.push(value[i].parts);
		}
		return partArr.unique();;
	}
}

function operFormatter(value, row) {
	var operTemp = $("#illOperTemp").clone();
	var lis = operTemp.find("ul li");
	lis.eq(0).find("a").attr("href", "./jsp/illness/illnessdetail.jsp?illName="+row.illness);
	lis.eq(1).find("a").attr("onClick", "deleteIll(\""+row.illness+"\")");	
	lis.eq(2).find("a").attr("onClick", "exportIll(\""+row.illness+"\")");	
	return operTemp.html();
}

function exportIll(illness){
	window.location.href = "./adminIllness/exportIllness?illness="+illness;
}

function deleteIll(illness){
	$.messager.model = { 
		//定义消息提示框
	   	ok:{ text: "确定", classed: 'btn-success' },
	    cancel:{text:"取消",classed: 'btn-danger' }
	};
	$.messager.confirm("确认操作", "确定删除疾病：'"+illness+ "'?", function() {
		$.ajax({
			url : "./illOper/deleteIll",
			type : 'POST',
			data : {
				illness :illness
			},
			dataType : 'json',
			success : function(ret) {
                 if(ret.resultCode == 0){
                     $.messager.popup("操作成功");
                     $('#table').bootstrapTable('refresh', {
						query : {
							offset: 0
						},
						silent : true
					});
                 }else{
                     $.messager.popup("操作失败");
                 }
			}
		});
	});
}

function editill(illness,symptoms,duration,isInjured,examNames,parts,specialCrowd,levelOneSubject,levelTwoSubject,pathogen,scheme,medicine,diseaseAge){
	$("#createwrap").show();
	$("#illnessName").val(decodeURI(illness));
	$("#illnessName").attr({readonly:'true'});
    $("#symptoms").val(decodeURI(symptoms));
    $("#duration").val(decodeURI(duration));
    $("#examNames").val(decodeURI(examNames));
    $("#parts").val(decodeURI(parts));
    $("#specialCrowdSel").val(decodeURI(specialCrowd));
    $("#levelOneSubject").val(decodeURI(levelOneSubject));
    $("#levelTwoSubject").val(decodeURI(levelTwoSubject));
    $("#diseaseAge").val(decodeURI(diseaseAge));
    $("#isInjured").val(decodeURI(isInjured)==1?"是":"否");
    $("#pathogen").val(decodeURI(pathogen));
  	$("#scheme").val(decodeURI(scheme));
  	$("#medicine").val(decodeURI(medicine));
	$("#createwrap").dialog({
         	title   : "编辑疾病记录",
        	'class' :  "mydialog",
        	onClose : function() { 
         		 $(this).dialog("close");
         		 $("#illnessName").removeAttr("readonly");
         		 $("#illnessName").val('');
          		 $("#symptoms").val('');
          		 $("#duration").val('');
          		 $("#examNames").val('');
          		 $("#parts").val('');
          		 $("#specialCrowd").val('');
          		 $("#levelOneSubject").val('');
          		 $("#levelTwoSubject").val('');
          		 $("#diseaseAge").val('');
          		 $("#pathogen").val('');
			  	 $("#scheme").val('');
			  	 $("#medicine").val('');
          	}, 
          	buttons : [{
          		text : "提交",
          		'class' : "btn btn-primary",
             	click : function() {
             		var illness = $("#illnessName").val();
             		var symptoms = $("#symptoms").val();
             		var duration = $("#duration").val();
             		var examNames = $("#examNames").val();
             		var parts = $("#parts").val();
             		var specialCrowd = $("#specialCrowdSel").val();
             		var levelOneSubject = $("#levelOneSubject").val();
             		var levelTwoSubject = $("#levelTwoSubject").val();
             		var isInjured = $("#isInjuredSel").val();
             		var pathogen = $("#pathogen").val();
             		var scheme = $("#scheme").val();
             		var medicine = $("#medicine").val();
             		var age = $("#sdiseaseAgeSel").val();
					var diseaseAge;
					if(age.length>0){
						var l = age.length;
						if(l==1){
							diseaseAge = age[0];
						}else{
							diseaseAge=(age[0].split(","))[0]+","+(age[l-1].split(","))[1];
						}
					}else{
						diseaseAge = '';
					}
//删            		
$.ajax({
     url: "./illOper/deleteSymptom",
     data: {
         illness: illness
     },
     type: "POST",
     dataType: 'json',
     cache: false,
     success: function (ret) {
         if (ret.resultCode == 0) {
         
         //删
         
         	$.ajax({
			     url: "./illOper/deleteParts",
			     data: {
			         illness: illness
			     },
			     type: "POST",
			     dataType: 'json',
			     cache: false,
			     success: function (ret) {
			         if (ret.resultCode == 1) {
			         
			         //开始更改
			         
						   $.ajax({
			                  url: "./adminIllness/editIllnessRecort",
			                  data: {
			                      illness: illness,
			                      symptoms: symptoms,
			                      duration:duration,
			                      pathogen : pathogen,
			                      scheme : scheme,
			                      medicine :medicine,
			                      isInjured:isInjured,
			                      examNames :examNames,
			                      parts: parts,
			                      specialCrowd: specialCrowd,
			                      levelOneSubject : levelOneSubject,
			                      levelTwoSubject : levelTwoSubject,
			                      diseaseAge : diseaseAge
			                  },
			                  type: "POST",
			                  dataType: 'json',
			                  cache: false,
			                  success: function (ret) {
			                      if (ret.resultCode == 0) {
			                          $.messager.popup("温馨提示:编辑疾病成功!");
			                          $('#table').bootstrapTable('refresh', {
										query : {
											offset: 0
										},
										silent : true
									});
			                      }else{
			                      	$.messager.popup("温馨提示:编辑疾病失败!");
			                      }
			                      $(this).dialog("close");
			                  }
			              });
			         }else{
			         	$.messager.popup("温馨提示:编辑疾病失败!");
			         }
			         $(this).dialog("close");
			     }
			 }); 
         
         }else{
         	$.messager.popup("温馨提示:编辑疾病失败!");
         }
         $(this).dialog("close");
     }
 });            		

             		
                 $(this).dialog("close");
                 $("#illnessName").removeAttr("readonly");
                 $("#illnessName").val('');
             		 $("#symptoms").val('');
             		 $("#duration").val('');
             		 $("#examNames").val('');
             		 $("#parts").val('');
             		 $("#specialCrowd").val('');
             		 $("#levelOneSubject").val('');
             		 $("#levelTwoSubject").val('');
             		 $("#diseaseAge").val('');
             		 $("#pathogen").val('');
			  	 	 $("#scheme").val('');
			  	 	 $("#medicine").val('');
             	}
             },{
             text : "关闭",
             'class' : "btn btn-default",
             click : function() {
                	 $(this).dialog("close");
                	 $("#illnessName").removeAttr("readonly");
                	 $("#illnessName").val('');
             		 $("#symptoms").val('');
             		 $("#duration").val('');
             		 $("#examNames").val('');
             		 $("#parts").val('');
             		 $("#specialCrowd").val('');
             		 $("#levelOneSubject").val('');
             		 $("#levelTwoSubject").val('');
             		 $("#diseaseAge").val('');
             		 $("#pathogen").val('');
			  	 	 $("#scheme").val('');
			  	 	 $("#medicine").val('');
             	}
         }]
     });
}

function dateFormatter(value, row){
	if(value!=null){
		return getSmpFormatDateByLong(value, true);
	}else{
		return '-';
	}
}

/* function ageFormatter(value, row){

	var length = row.ages.length;
	if(length==0){
		return '';
	}
	if(length==7){
		return '全年龄段';
	}
	var ages = '';
	for(var i=0;i<length;i++){
		var s = row.ages[i].ageOption;
		var ss;
		if(s==1){
			ss = '0-30天';
		}else if(s==2){
			ss = '31天-3岁';
		}else if(s==3){
			ss = '4-8岁';
		}else if(s==4){
			ss = '9-14岁';
		}else if(s==5){
			ss = '15-35岁';
		}else if(s==6){
			ss = '36-64岁';
		}else if(s==7){
			ss = '65岁以上';
		}
		ages =ages + ',' + ss  ;
	}
	var t = ages.substring(1,ages.length)
	return t;
} */

function detailFormatter(index, row) {
	var html=[];
	html.push('<div style="padding:10;">');
	html.push('<div class="bs-callout bs-callout-info">');
	
	html.push('<p><b>相关年龄:</b></br>' + ageFormatter(row) + '</p>');
	html.push('<p><b>相关性别:</b></br>' + sexFormatter(row.sex) + '</p>');
	html.push('<p><b>相关部位:</b></br>' + partsFormatter(row.symptoms) + '</p>');
	html.push('<p><b>相关症状:</b></br>' + symptomFormatter(row.symptoms) + '</p>');
	
	html.push('<p><b>发病时间:</b></br>' + row.duration + '</p>');
	html.push('<p><b>辅助检查:</b></br>' + row.assistantExam + '</p>');
	html.push('<p><b>诊疗方案 :</b></br> ' + row.scheme + '</p>');
	html.push('<p><b>相关用药 :</b></br> ' + row.medicine + '</p>');
	html.push('</div>');
	html.push('</div>');
	return html.join('');
}

function sexFormatter(value){
	if(value==0){
		return '男';
	}else if(value==1){
		return '女';
	}else if(value==2){
		return '全部';
	}else{
		return '-';
	}
}

function symptomFormatter(row){
	var symArr = [];
	for(var i=0;i<row.length;i++){
		symArr.push(row[i].symptom);
	}
	return unique(symArr).join("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
}

function partsFormatter(row){
	var partArr = [];
	for(var i=0;i<row.length;i++){
		if(row[i].parts=='' || row[i].parts==null){
			continue;
		}
		partArr.push(row[i].parts);
	}
	
	return unique(partArr).join("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
}

function ageFormatter(row){

	var length = row.ages.length;
	if(length==0){
		return '';
	}
	if(length==7){
		return '全年龄段';
	}
	var ages = '';
	for(var i=0;i<length;i++){
		var s = row.ages[i].ageOption;
		var ss;
		if(s==1){
			ss = '0-30天';
		}else if(s==2){
			ss = '31天-3岁';
		}else if(s==3){
			ss = '4-8岁';
		}else if(s==4){
			ss = '9-14岁';
		}else if(s==5){
			ss = '15-35岁';
		}else if(s==6){
			ss = '36-64岁';
		}else if(s==7){
			ss = '65岁以上';
		}
		ages = ages + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + ss  ;
	}
/* 	var t = ages.substring(1,ages.length) */
	return ages;
}

function warningFormatter(value,row){
	if(value=='' || value==null){
		return '-';
	}else{
		if(value=='1'){
			return '轻微（'+value+'）';
		}else if(value=='2'){
			return '稍重（'+value+'）';
		}else if(value=='3'){
			return '较重（'+value+'）';
		}else if(value=='4'){
			return '危重（'+value+'）';
		}else{
			return '-';
		}
	}
	
}
</script>
</body>
</html>